#pragma once

#include "common.h"
#include "singletonmodel.h"

#ifndef WIN32
#include <time.h>
#include <sys/time.h>		// Linux needs both time.h and sys/time.h
#endif

class NtdTime: public SingletonModel<NtdTime>
{
public:
	NtdTime();

	void Init();

	uint32 GetCurrentTime_ms();

	uint64 GetCurrentTime_us();

private:

#ifndef WIN32
	timeval m_starttick;
#else
	uint64 m_startPerformanceCounter;
	double m_counterPerMicrosecond;
#endif
};

#define Now_ms() (NtdTime::Instance()->GetCurrentTime_ms())
#define Now_us() (NtdTime::Instance()->GetCurrentTime_us())
